
StreamIO
--------


vtbl
----
0x4D74FC	StreamIO
0x4D6B20	StreamIO:BaseVolFileStream:VolFileRStream




StreamIO
--------
Offset 	Size 	Description
------ 	---- 	-----------
0x0	4	vtbl
0x4	4	numBytesReadOrWritten  [most recent Read/WriteFile]
0x8	4	int streamStatus  [0 == OK, otherwise == errorCode]
---------------------------




StreamIO:FileRStream
--------------------
Offset	Size	Description
------	----	-----------
0xC	0x800	char[2048] buffer
0x80C	4	int positionOfLastReadChunkStart
0x810	4	int positionOfLastReadChunkEnd
0x814	4	int streamPosition
0x818	4	hFile


StreamIO:FileWStream
--------------------
Offset	Size	Description
------	----	-----------
0xC	4	hFile


StreamIO:RLERStream
-------------------
Offset	Size	Description
------	----	-----------
0xC	4	StreamIO* internalStream
0x10	1	char repeatedChar	[Char to repeat]
0x11	1	char numTimesToRepeat	[Repeat count]
0x12	1	char chunkSize		[Raw data copy size]
...
0x92	4	int streamPosition


StreamIO:LZRStream
------------------
Offset	Size	Description
------	----	-----------
0xC	4	StreamIO* internalStream
0x10	4	int streamPosition
0x14	4	char[4096]* buffer
0x18	4	int writeIndex
0x1C	1	char currentByte
0x1E	2	short currentBitMask	[Initially 0x80]
0x20	4	int numCharsRepeated	[Repeat progress]
0x24	4	bool bRepeating		[Buffer filled during repeat]
0x28	4	int repeatIndex
0x2C	4	int repeatedRunLength


StreamIO:LZWStream
------------------
Offset	Size	Description
------	----	-----------
0xC	4	StreamIO* internalStream
0x10		
0x14	4	char[4096]* buffer
0x18	4	char[4096*12 + 12]* buffer


StreamIO:LZHRStream
-------------------
Offset	Size	Description
------	----	-----------
0xC	4	StreamIO* internalStream
0x10	4	AdaptiveHuffmanTree* compressionTree
0x14	4	char[4096 + 59]* circularBuffer
0x18	4	int matchIndex
0x1C	4	int numCharsInRun
0x20	4	int numCharsCopied
0x24	4	int writeIndex
0x28	4	int streamPosition


StreamIO:LZHWStream
-------------------
Offset	Size	Description
------	----	-----------
0xC	4	StreamIO* internalStream  [Write destination]
0x10	4	AdaptiveHuffmanTree* compressionTree
0x14	4	int ? Index
0x18	4	int writeIndex
0x1C	4	
0x20	4	
0x24	4	
0x28	4	
0x2C	4	int runOffset
0x30	4	int runLength
0x34	4	int streamPosition
0x38	4	char[4096 + 59]* circularBuffer
0x3C	4	char[8192 + 2]* 
0x40	4	char[8192 + 512 + 2]* 
0x44	4	char[8192 + 2]* 


StreamIO:BaseVBlkRWStream
-------------------------
Offset	Size	Description
------	----	-----------
0xC	4	StreamIO* internalStream
----------------
0x10	8	StreamHeaderInfo headerBlock
 0x10	 4	 int tag		['VBLK']
 0x14	 4:31	  int streamSize	[includes header block]
 0x14	 4:1	  int alignment		[0 = 16 bit, 1 = 32 bit]
----------------
0x18	4	int streamPosition	[including header size]
0x1C	4	int streamStartPosition


StreamIO:BaseVolFileStream
--------------------------
Offset 	Size 	Description
------ 	---- 	-----------
0xC	4	int numIndexEntries
0x10	4	IndexEntry[]* indexTable
0x14	4	void* fileNameBuffer  [vols section]
0x18	4	LPVOID mappedAddress  [memory mapped file]
0x1C	4	HANDLE fileMapping    [file mapping object]
0x20	4	HANDLE fileHandle     [VOL file handle]
0x24	4	DWORD fileSize        [VOL fiel size, or -1]
0x28	4	StreamIO* openedInternalStream
0x2C	?	StreamIO:MemRWStream inputStream
0x44	?	StreamIO:VBlkRWStream vblkStream[Case0: Uncompressed] 
0x64	?	StreamIO:RLERStream		[Case1: RLE]
0xFC	?	StreamIO:LZHRStream		[Case3: LZH]
0x128	?	StreamIO:LZRStream		[Case2: LZ]


StreamIO:BaseVolFileStream:VolFileRStream
-----------------------------------------
Size: 2432 bytes [0x980 bytes]
Note: VolFile can have only one open stream at a time.
Note: VolFile derives from StreamIO and is useable to refer to it's opened stream

Offset 	Size 	Description
------ 	---- 	-----------
0x158	4	boolSetFileSize  [true => on Open set file size to fileSize]
0x15C	4	char*
0x160	?	StreamIO:FileRStream


